<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="./css/global.css" />
    <link rel="stylesheet" href="css/login.css" />
    <title>Document</title>
  </head>
  <body>
      <div class="box">
        <!-- 侧边图片区域 -->
        <div class="pic"></div>
        <!-- 登录表单区域 -->
        <div class="loginForm">
          <h2>用户登录</h2>
          <form action="">
            <div>
              <input type="text" name="username" placeholder="请输入用户名称" />
              <span class="err-info"></span>
            </div>
            <div>
              <input
              type="password"
              name="password"
              placeholder="请输入用户密码"
            />
            <span class="err-info"></span>
            </div>
            <a class="button" for="login" href="./index.html">登录</a>
          </form>
          <div class="division">
            <div class="divisionText">或者使用电子邮箱登录</div>
          </div>
          <div class="otherWay">
              <a class="button" for="weixin" size="lognBtn">微信登录</a>

              <a class="button" for="weibo" size="lognBtn">微博登录</a>
          </div>
        </div>
      </div>

      <script>
        const username = document.querySelector("input[name='username']");
        const password = document.querySelector("input[name='password']");
        username.onblur = function () {
          if (!username.value) {
            username.nextElementSibling.innerHTML = "用户名不能为空";
          }
        }
        password.onblur = function () {
          if (!password.value) {
            password.nextElementSibling.innerHTML = "密码不能为空";
          }
        }
      </script>
  </body>
</html>
